<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
		function cal() {
					var nums = document.getElementsByName("num");
					var result = document.getElementsByName("rs");
					var n1 = parseFloat(nums[0].value);
					if (n1 <= 3500)
					{
					return result[0].value = 0;
				} 
				else if (n1 > 3500 & n1 <= 8000) {
					return result[0].value = (n1 - 3500) * 2 / 100;
				}
				 else if (n1 <= 20000 & n1 > 8000) {
					return result[0].value = (n1 - 8000) * 5 / 100 + (8000 - 3500) * 2 / 100;
				} 
				else if (n1 > 20000) {
				    return result[0].value = (n1 - 20000) * 10 / 100 + (20000 - 8000) * 5 / 100 + (8000 - 3500) * 2 / 100;
				}
			}
		</script>
	</head>
	<body>
		<div align="center">
				<label for="num">输入薪水</label>
				<input type="text" name="num" value=""
					onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" /><br />
					<label>个税结果</label>
				<input type="text" name="rs" value="" /><br>
				<button id="btn" onclick="cal()">算个税</button>
			</div>
	</body>
</html>